<?php
class collect_cnbeta extends collect {
	public function __construct() {
		//$list = $this->getList();
		//$this->getItem($list[1]);
	}
	
	public function getList() {
		$listUrl = 'http://www.cnbeta.com/backend.php';
		
		$listContent = $this->getUrl($listUrl);
		preg_match_all('/<link>(.+?)<\/link>/si', $listContent, $matches);
		
		array_shift($matches[1]);
		array_shift($matches[1]);
		
		return $matches[1];
	}
	
	public function getItem($url) {
		$itemContent = $this->getUrl($url);
		$itemData = array();
		
		$itemData['url'] = $url;
		
		preg_match('/<h3 id="news_title">(.*?)<\/h3>/si', $itemContent, $matches);
		$itemData['title'] = trim($matches[1]);
		
		preg_match('/onload="fixPNG\(this\)"\/><\/a>(.*?)<div class="digbox">/si', $itemContent, $matches);
		$itemData['body'] = trim(preg_replace('/<b>感谢(.*?)的投递<\/b><br \/>/si', '', $matches[1]));

		print_r($itemData);
	}
}